begintownscript;

variables;

int i,j,k,choice,pc,level;

body;

beginstate INIT_STATE;

set_crime_tolerance(1);
set_name(8, "Commander Clemmow");

if (get_flag(0, 0) == 0 && get_flag(200, 0) == 0)
{	
	force_instant_terrain_redraw();
	
	reset_dialog();
	add_dialog_str(0, "After hearing news of the native attack, you realised there was only one thing to do.", 0);
	add_dialog_str(1, "This outpost is only around a mile from one of the greatest temples to the natives' false gods.", 0);
	add_dialog_str(2, "If you can launch an attack quickly - however unsuccessful - you might just be able to disrupt their plans, forcing them to defend the temple.", 0);
	add_dialog_str(3, "To do that, of course, you need soldiers. Fortunately, you constructed a small barracks here under the control of one of your most trusted military commanders.", 0);
	add_dialog_str(4, "Your forces are small, but if you can maintain the element of surprise, you just might be able to distract the natives.", 0);
	add_dialog_choice(0, "OK");
	run_dialog(1);
	set_flag(0, 0, 1);
	toggle_quest(0, 1);
}
break;

beginstate EXIT_STATE;
// Always called when the town is left.
break;

beginstate START_STATE;
// This state is called every turn the party is in this town.
	if(get_crime_level() > 0)
	{
		reset_dialog();
		add_dialog_str(0, "This is no time to be killing the soldiers under you.", 0);
		add_dialog_str(1, "They fight back, and it doesn't end well.", 0);
		add_dialog_choice(0, "OK");
		run_dialog(1);
		kill_char(1000,3,0);
	}
break;

beginstate 10;
	if (get_flag(0, 3) == 1)
	{
		move_to_new_town(1, 5, 4);
	}
	else
	{
		reset_dialog();
		add_dialog_str(0, "Time might be critical, but it's not so critical that you have to go ahead alone.", 0);
		add_dialog_str(1, "Probably best to visit the Commander of the outpost and see what troops he has available.", 0);
		add_dialog_choice(0, "OK");
		run_dialog(1);
		block_entry(1);
	}
break;

beginstate 11;
	if ((get_flag(0, 4) == 0) && (get_flag(0, 3) == 1))
	{
		reset_dialog();
		add_dialog_str(0, "Across the courtyard, you see the soldiers that will be under your command filing out of the barracks.", 0);
		add_dialog_str(1, "The first thing that you notice is that there are only five of them.", 0);
		add_dialog_str(2, "This is to be expected with the apparently vital mission just down the river, but you'd hoped for better.", 0);
		add_dialog_str(3, "At least they look a bit healthier than Clemmow.", 0);
		add_dialog_choice(0, "OK");
		run_dialog(1);
		set_flag(0, 4, 1);
		activate_hidden_group(1);
	}
break;

beginstate 12;
	if ((get_flag(0, 5) == 0) && (get_flag(0, 3) == 1))
	{
		reset_dialog();
		add_dialog_str(0, "The Captain of the soldiers greets you.", 0);
		add_dialog_str(1, "It seems like he's trying to be cheerful, but it's clear he's terrified.", 0);
		add_dialog_str(2, "You doubt they'd be much good if you came across an Eagle Warrior.", 0);
		add_dialog_str(3, "Fortunately, you find a stock of fire bombs in the barracks, so you can at least stay safe by burning down the jungle.", 0);
		add_dialog_choice(0, "OK");
		run_dialog(1);
		set_flag(0, 5, 1);
		reward_give(476);
		reward_give(476);
		reward_give(476);
	}
break;

beginstate 13;
	if (get_flag(0, 2) == 0)
	{
		reset_dialog();
		add_dialog_str(0, "You walk into the Commander Clemmow's office.", 0);
		add_dialog_str(1, "It's just as humid and unpleasant as the rest of this place. The scrolls in the shelves on the walls are already rotting.", 0);
		add_dialog_str(2, "And Clemmow looks ill. You fear that, if he has one of the more common illnesses of the region, he'll not last much longer.", 0);
		add_dialog_str(3, "This is really a shock - one of his defining features before this expedition was his good health.", 0);
		add_dialog_choice(0, "OK");
		run_dialog(1);
		set_flag(0, 2, 1);
	}
break;

beginstate 14;
	if (get_flag(0, 1) == 0)
	{
		reset_dialog();
		add_dialog_str(0, "A sign below one of the corpses states:", 0);
		add_dialog_str(1, "_THOSE SUSPECTED OF PRACTICING OUTLAWED MAGICKS ARE TO BE HANGED BY ORDER OF THE REPUBLIC SENATE._", 10);
		add_dialog_str(2, "Commander Clemmow seems to have been doing his job well.", 0);
		add_dialog_choice(0, "OK");
		run_dialog(1);
		set_flag(0, 1, 1);
	}
break;

beginstate 15;
	if (get_flag(0, 6) == 0)
	{
		reset_dialog();
		add_dialog_str(0, "You poke around in the bookshelf for a few minutes.", 0);
		add_dialog_str(1, "Finally, you locate a text that's not completely coated with mould.", 0);
		add_dialog_str(2, "Unfortunately, it seems to be entirely empty. There goes your chance of having some reading material.", 0);
		add_dialog_choice(0, "OK");
		run_dialog(1);
		set_flag(0, 6, 1);
	}
break;

beginstate 16;
	if (get_flag(0, 7) == 0)
	{
		reset_dialog();
		add_dialog_str(0, "This ladder seems to lead up to the roof space of the hut.", 0);
		add_dialog_str(1, "At the top is a fairly flimsy trapdoor.", 0);
		add_dialog_str(2, "Whilst it's probably not too difficult to break it open, you suspect that Clemmow's private rooms are above, and that he'd prefer it if you respected his privacy.", 0);
		add_dialog_choice(0, "OK");
		run_dialog(1);
		set_flag(0, 7, 1);
	}
break;

